package com.lmx.repoDomain.tmodel;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import com.lmx.repoDomain.tmodel.business.User;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;
/**
 * 护理日志表
 * @author jing
 *
 */
@JsonApiResource(type = "nursinglog")
@Table(name = "tnb_nursinglog")
@Entity
public class NursingLog extends BaseEntity {

	private Customer nurscustomer; //所对应的老人信息
	
	private Integer nursingDate;  //护理日期，对应的是昨天护理日期
	
	private String remark;     //记录的内容
	
	private Employee recordUser;  //记录人
	
	private User createUser;  //创建人
	
	private Integer recordTime; //记录的时间
	
	@JsonApiToOne
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "customer_id", foreignKey = @ForeignKey(name = "null"))
	public Customer getNurscustomer() {
		return nurscustomer;
	}

	public void setNurscustomer(Customer nurscustomer) {
		this.nurscustomer = nurscustomer;
	}
	
	@Column(name="nursingDate")
	public Integer getNursingDate() {
		return nursingDate;
	}

	public void setNursingDate(Integer nursingDate) {
		this.nursingDate = nursingDate;
	}

	@Column(name="remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	} 

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "recorduser_id", foreignKey = @ForeignKey(name = "null"))
	public Employee getRecordUser() {
		return recordUser;
	} 

	public void setRecordUser(Employee recordUser) {
		this.recordUser = recordUser;
	}

	@Column(name="recordTime")
	public Integer getRecordTime() {
		return recordTime;
	}

	public void setRecordTime(Integer recordTime) {
		this.recordTime = recordTime;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "createuser_id", foreignKey = @ForeignKey(name = "null"))
	public User getCreateUser() {
		return createUser;
	}

	public void setCreateUser(User createUser) {
		this.createUser = createUser;
	}
	
	
	
}
